-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-10-19
-- Description: DO NOT EDIT; Code generated by "service.lua.mako"
local mdb = require 'mc.mdb'
local class = require 'mc.class'
local context = require 'mc.context'
local app_base = require 'mc.service_app_base'
local object_manage = require 'mc.mdb.object_manage'

local DataSyncTypes = require 'bmc_datasync.json_types.DataSync'
local PropertiesTypes = require 'bmc_datasync.json_types.Properties'

local DataSync = mdb.register_object('/bmc/kepler/Managers/:ManagerId/DataSync', {
    {name = 'bmc.kepler.Managers.DataSync', interface = DataSyncTypes.interface},
    {name = 'bmc.kepler.Object.Properties', interface = PropertiesTypes.interface}
})

function DataSync:ctor(ManagerId)
    self.path = '/bmc/kepler/Managers/' .. ManagerId .. '/DataSync'
end

local model = require 'class.model'

local bmc_datasync_service = class(app_base.Service)

bmc_datasync_service.package = 'bmc_datasync'

function bmc_datasync_service:CreateDataSync(ManagerId, prop_setting_cb)
    local path = '/bmc/kepler/Managers/' .. ManagerId .. '/DataSync'
    return object_manage.create_object('DataSync', path, path, prop_setting_cb)
end

function bmc_datasync_service:ImplDataSyncDataSyncGetProperties(cb)
    model.ImplDataSyncDataSyncGetProperties(cb)
end

---@param mdb_object object
---@param Identifier integer
---@param ObjectName string
---@param Interface string
function bmc_datasync_service:DataSyncDataSyncPropertyUpdated(mdb_object, Identifier, ObjectName, Interface)
    self.bus:signal(mdb_object.path, 'bmc.kepler.Managers.DataSync', 'PropertyUpdated', 'a{ss}yss',
        context.get_context() or {}, Identifier, ObjectName, Interface)
end

function bmc_datasync_service:get_bus()
    return self.bus
end

function bmc_datasync_service:ctor()
    self.signal_slots = {}
    self.name = self.name or bmc_datasync_service.package

    self.bus:request_name(app_base.Service.get_service_name(self.name))
    model.init(self.bus)
    bmc_datasync_service.bus = self.bus
end

function bmc_datasync_service:pre_init()
    bmc_datasync_service.super.pre_init(self)
end

function bmc_datasync_service:init()
    bmc_datasync_service.super.init(self)
end

return bmc_datasync_service
